#ifndef MAKEDATA_H
#define MAKEDATA_H

#include <iostream>
#include <random>
#include <stdio.h>
#include <string>
#include <windows.h>

std::string data_file = "data";        // 数据储存文件夹
std::string data_name = "data";        // 数据名称
std::string stdcode_name = "stdcoder"; // 标称名称
int data_times = 10;                   // 数据生成个数

char b[1005];
char cb[1005];

void file(int data_number) {
    sprintf(b, "%s\\%s%d.in", data_file.c_str(), data_name.c_str(),
            data_number);
    freopen(b, "w", stdout);
}

void close(int data_number) {
    fclose(stdout);
    sprintf(cb, "%s.exe <%s\\%s%d.in >%s\\%s%d.out", stdcode_name.c_str(),
            data_file.c_str(), data_name.c_str(), data_number,
            data_file.c_str(), data_name.c_str(), data_number);
    system(cb);
}

int rand_32(int a, int b) {
    std::mt19937 rd(std::random_device{}());
    std::uniform_int_distribution<int> dis(a, b);
    return dis(rd);
}

long long rand_64(long long a, long long b) {
    std::mt19937_64 rd64(std::random_device{}());
    std::uniform_int_distribution<long long> dis(a, b);
    return dis(rd64);
}

#endif
